<template>
  <a-layout>
    <a-layout-header :style="{ position: 'fixed', zIndex: 1, width: '100%' }">
      <div class="logo" />
      <a-menu
          v-model:selectedKeys="selectedKeys"
          theme="dark"
          mode="horizontal"
          :style="{ lineHeight: '64px' }"
      >
        <a-menu-item key="1">人脸录入</a-menu-item>
        <a-menu-item key="2">人脸识别校验</a-menu-item>
      </a-menu>
    </a-layout-header>
    <a-layout-content :style="{ padding: '0 50px', marginTop: '64px' }">
      <component :is="currentComponent" :style="{ background: '#fff', padding: '24px', minHeight: '380px' }"></component>
    </a-layout-content>
    <a-layout-footer :style="{ textAlign: 'center' }">
      软件2125 @ 王川、杨驭驭、丁文宗
    </a-layout-footer>
  </a-layout>
</template>
<script lang="ts" setup>
import FaceEntry from './FaceEntry.vue';
import FaceRecognition from './FaceRecognition.vue';
import {computed, ref} from "vue";

const selectedKeys = ref<string[]>(['2']);

// 注册组件
const components = { FaceEntry, FaceRecognition };

// 计算属性，根据selectedKeys决定显示哪个组件
const currentComponent = computed(() => {
  return selectedKeys.value.includes('1') ? FaceEntry : FaceRecognition;
});

</script>
<style scoped>
#components-layout-demo-fixed .logo {
  width: 120px;
  height: 31px;
  background: rgba(255, 255, 255, 0.2);
  margin: 16px 24px 16px 0;
  float: left;
}
.site-layout .site-layout-background {
  background: #fff;
}

[data-theme='dark'] .site-layout .site-layout-background {
  background: #141414;
}
</style>